package com.hhl.shardingjdbc.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hhl.shardingjdbc.entity.Order;
import com.hhl.shardingjdbc.mapper.OrderMapper;
import com.hhl.shardingjdbc.service.IOrderService;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements IOrderService{

    @Override
    public IPage<Order> getPage(IPage<Order> iPage,String userName) {
        LambdaQueryWrapper<Order> queryWrapper = new LambdaQueryWrapper<Order>();
        queryWrapper.eq(!ObjectUtils.isEmpty(userName),Order::getUserName,userName);
        IPage<Order> page = this.page(iPage, queryWrapper);
        return page;
    }
}
